package com.lss.studydemo;

import android.util.Log;

public class TemperatureAlarm implements TemperatureListener{
    @Override
    public void onTemperatureExceeded(TemperatureEvent event) {
        float current = event.getCurrentTemperature();
        float target = event.getTargetTemperature();
        Log.i("lss", String.format("警告！当前温度 %.1f°C 已超过阈值 %.1f°C", current, target));

        // 实际应用中这里可以触发声音警报、LED闪烁等
    }

    @Override
    public void onTemperatureReached(TemperatureEvent event) {
        float current = event.getCurrentTemperature();
        float target = event.getTargetTemperature();
        Log.i("lss", String.format("警报解除！当前温度 %.1f°C 已回归正常范围", current));
    }
}
